.code-layout-split-base {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;

  .split-n-container > .content {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  &.vertical {
    flex-direction: column;
    justify-content: stretch;
    align-items: flex-start;

    > .split-n-container {
      position: relative;
      flex-shrink: 0;
      width: 100%;
    }
    > .code-layout-split-dragger, > .split-n-container > .code-layout-split-dragger {
      width: 100%;
      height: var(--code-layout-border-size);
      cursor: ns-resize;

      &::after {
        left: 0;
        right: 0;
        top: calc(var(--code-layout-border-size-dragger) / -2);
        height: var(--code-layout-border-size-dragger);
        bottom: unset;
        width: unset;
      }

      &.inner {
        position: absolute;
        left: 0;
        top: 0;
      }

      > .code-layout-split-orthogonal-drag-handle {
        top: calc(var(--code-layout-sash-size) / -2);
        &.start {
          left: calc(var(--code-layout-sash-size) / -2);
        }
        &.end {
          right: calc(var(--code-layout-sash-size) / -2);
        }
      }
    }
  }
  &.horizontal {
    flex-direction: row;
    justify-content: flex-start;
    align-items: stretch;

    > .split-n-container {
      position: relative;
      height: 100%;
      flex-shrink: 0;
    }
    > .code-layout-split-dragger, > .split-n-container > .code-layout-split-dragger {
      width: var(--code-layout-border-size);
      height: 100%;
      cursor: ew-resize;

      &::after {
        top: 0;
        bottom: 0;
        left: calc(var(--code-layout-border-size-dragger) / -2);
        width: var(--code-layout-border-size-dragger);
      }

      &.inner {
        position: absolute;
        left: 0;
        top: 0;
      }

      > .code-layout-split-orthogonal-drag-handle {
        left: calc(var(--code-layout-sash-size) / -2);
        &.start {
          top: calc(var(--code-layout-sash-size) / -2);
        }
        &.end {
          bottom: calc(var(--code-layout-sash-size) / -2);
        }
      }
    }
  }

  > .code-layout-split-dragger, > .split-n-container > .code-layout-split-dragger {
    position: relative;
    height: 100%;
    width: var(--code-layout-border-size);
    background-color: var(--code-layout-color-border-background);
    cursor: ns-resize;
    user-select: none;
    overflow: visible;

    &::after {
      position: absolute;
      content: '';
      transition: background-color ease-in-out 0.2s;
      z-index: 10;
    }

    &.resize:hover, &.active {
      &::after {
        background-color: var(--code-layout-color-highlight);
      }
    }
  }
}

.code-layout-split-orthogonal-drag-handle {
  position: absolute;
  width: var(--code-layout-sash-size);
  height: var(--code-layout-sash-size);
  cursor: all-scroll;
  z-index: 20;
  background-color: transparent;
  user-select: none;
}

.code-layout-split-tab {
  position: relative;
  width: 100%;
  height: 100%;

  --tab-height: 35px;
  --tab-font-size: 12px;
  --tab-icon-size: 14px;
  --tab-text-color: var(--code-layout-color-text);
  --tab-active-text-color: var(--code-layout-color-text-light);
  --tab-mormal-color: var(--code-layout-color-background-light);
  --tab-active-color: var(--code-layout-color-background);
  --tab-border-color: var(--code-layout-color-background-second);
  --tab-button-normal-color: transparent;
  --tab-button-hover-color: var(--code-layout-color-background-hover-light);
  --tab-close-size: 18px;
}
.code-layout-split-tab-list {

  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  height: var(--tab-height);
  background-color: var(--tab-border-color);

  &::before {
    display: block;
    position: absolute;
    content: '';
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    z-index: 0;
    background-color: var(--tab-border-color);
  }

  &.drag-active {
    background-color: var(--code-layout-color-background-hover);
  }

  .code-layout-split-tab-list-tabs {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow: scroll;
    overflow-y: hidden;
    transition: all ease-in-out 0.25s;

    .code-layout-tooltip-ref {
      height: 100%;
    }

    .item {
      position: relative;
      display: inline-flex;
      padding: 0px 10px;
      cursor: pointer;
      color: var(--tab-text-color);
      background-color: var(--tab-mormal-color);
      border: 1px solid transparent;
      border-bottom-color: var(--tab-border-color);
      border-right-color: var(--tab-active-color);
      justify-content: center;
      align-items: center;
      height: 100%;
      vertical-align: middle;

      &::after {
        position: absolute;
        content: '';
        background-color: var(--code-layout-color-border-white);
        z-index: 2;
        width: var(--code-layout-border-size-larger);
      }
      &.drag-over-left {
        &::after {
          top: 0;
          bottom: 0;
          left: calc(var(--code-layout-border-size-larger) / 2 * -1);
        }
      }
      &.drag-over-right {
        &::after {
          top: 0;
          bottom: 0;
          right: calc(var(--code-layout-border-size-larger) / 2 * -1);
        }
      }

      .icon {
        display: inline-block;
        padding: 0;
        font-size: var(--tab-icon-size);
      }
      .close {
        text-decoration: none;
        color: var(--tab-text-color);
        user-select: none;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        width: var(--tab-close-size);
        height: var(--tab-close-size);
        border-radius: 3px;
        padding: 0;

        &:hover {
          background-color: var(--tab-button-hover-color);
        }

        .close-icon {
          visibility: hidden;
          width: var(--tab-close-size);
          height: var(--tab-close-size);
        }
        .unsave-dot {
          width: 14px;
          height: 14px;
        }
      }
      .badge {
        display: inline-block;
        padding: 3px;
        border-radius: var(--code-layout-font-size-small);
        font-size: var(--code-layout-font-size-small);
        min-width: var(--code-layout-font-size-small);
        line-height: var(--code-layout-font-size-small);
        text-align: center;
        background-color: var(--code-layout-color-highlight);
        color: var(--code-layout-color-text-light);
        transform: scale(0.9);
      }

      > span {
        display: inline-block;
        padding: 0 6px;
        font-size: var(--tab-font-size);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
      }

      &:hover { 
        .close-icon {
          visibility: visible;
        }
      }
  
      &.active {
        background-color: var(--tab-active-color);
        border-bottom-color: var(--tab-active-color);
        border-right-color: var(--tab-border-color);
        border-left-color: var(--tab-border-color);
        border-top-color: var(--tab-border-color);

        &::before {
          position: absolute;
          display: inline-block;
          content: '';
          width: 100%;
          bottom: -1px;
          left: 0;
          background-color: var(--tab-border-color);
        }
        .close {
          color: var(--tab-active-text-color);
        }
        .close-icon {
          visibility: visible;
        }
      }    
    }
  }
  .code-layout-split-tab-list-extra {
    display: flex;
    flex-grow: 1;
    flex-shrink: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    position: relative;

    > .code-layout-actions {
      font-size: var(--tab-font-size);

      svg {
        font-size: var(--tab-icon-size);
      }
    }
  }
}
.code-layout-split-tab-content {
  position: absolute;
  top: var(--tab-height);
  left: 0;
  right: 0;
  bottom: 0;

  &.empty {
    top: 0;
  }
  &.dragging * {
    pointer-events: none;
  }
  &.drag-active::before {
    position: absolute;
    content: '';
    background-color: var(--code-layout-color-background-mask-light);
    z-index: 20;
  }

  &.drag-over-center {
    &::before {
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
    }
  }
  &.drag-over-left {
    &::before {
      top: 0;
      bottom: 0;
      left: calc(var(--code-layout-border-size-larger) / 2 * -1);
      right: 50%;
    }
  }
  &.drag-over-up {
    &::before {
      top: calc(var(--code-layout-border-size-larger) / 2 * -1);
      bottom: 50%;
      left: 0;
      right: 0;
    }
  }
  &.drag-over-right {
    &::before {
      top: 0;
      bottom: 0;
      right: calc(var(--code-layout-border-size-larger) / 2 * -1);
      left: 50%;
    }
  }
  &.drag-over-down {
    &::before {
      top: 50%;
      left: 0;
      right: 0;
      bottom: calc(var(--code-layout-border-size-larger) / 2 * -1);
    }
  }
}

